export default ({ service, request, serviceForMock, requestForMock, mock, faker, tools }) => ({
  /**
   * @description 请求项目中的文件
   * @param {String} url 文件地址
   */
  PARAMS_GET (url = '/api/getConditionList') {
    return request({
      baseURL: process.env.BASE_URL,
      url,
      method: 'get'
    })
  },
  PARAMS_SAVE (data = {}) {
    return request({
      baseURL: process.env.BASE_URL,
      url:'/api/saveConditionList',
      method: 'post',
      data
    })
  },
  MONITOR_PAGE (data = {}) {
    return request({
      baseURL: process.env.BASE_URL,
      url:'/api/monitor/showPage',
      method: 'post',
      data
    })
  },
  MONITOR_ZXRS (data) {
    if(data==undefined || data==null){
      data="";
    }
    return request({
      baseURL: process.env.BASE_URL,
      url:'/api/monitor/getZxrs?dt='+data,
      method: 'get',
    })
  },
  TRAN_PAGE (data = {}) {
    return request({
      baseURL: process.env.BASE_URL,
      url:'/api/exchange/showPage',
      method: 'post',
      data
    })
  },
  MUX_DETAIL (id) {
    return request({
      baseURL: process.env.BASE_URL,
      url:'/api/mux/getClById?id='+id,
      method: 'get'
    })
  },
  MUX_PAGE (data = {}) {
    return request({
      baseURL: process.env.BASE_URL,
      url:'/api/mux/showPage',
      method: 'post',
      data
    })
  },
  SHOP_PAGE (data = {}) {
    return request({
      baseURL: process.env.BASE_URL,
      url:'/api/shop/showPage',
      method: 'post',
      data
    })
  },
  DIR_SET_GET () {
    return request({
      baseURL: process.env.BASE_URL,
      url:'/api/dir/getDirList',
      method: 'get'
    })
  },
  DIR_SET_ADD (data = {}) {
    return request({
      baseURL: process.env.BASE_URL,
      url:'/api/dir/saveDir',
      method: 'post',
      data
    })
  },
  DIR_SET_DEL (data = {}) {
    return request({
      baseURL: process.env.BASE_URL,
      url:'/api/dir/deleteDir',
      method: 'post',
      data
    })
  },
  setIntoStorage (type,value) {
  if(!value){
    return
  }
  let noArr = [],
  text = ''
  switch (type) {
    case 'monitorWpList':
    text = 'monitorWpList'
    break
    case 'monitorWjList':
    text = 'monitorWjList'
    break
    case 'monitorWpdjList':
    text = 'monitorWpdjList'
    break
    case 'monitorBhList':
    text = 'monitorBhList'
    break
    case 'tranWpList':
    text = 'tranWpList'
    break
    case 'tranJyzList':
    text = 'tranJyzList'
    break
    case 'muxZbList':
    text = 'muxZbList'
    break
    case 'muxWjList':
    text = 'muxWjList'
    break
    case 'shopWpList':
    text = 'shopWpList'
    break
    case 'shopWjList':
    text = 'shopWjList'
    break
    default:
    break
  }
  noArr.push({value: value, type: type})
    if(JSON.parse(localStorage.getItem(text))) { // 判断是否已有xxx查询记录的localStorage
      if(localStorage.getItem(text).indexOf(value) > -1 ) { // 判断是否已有此条查询记录，若已存在，则不需再存储
        return
      }
      if(JSON.parse(localStorage.getItem(text)).length >= 10) {
        let arr = JSON.parse(localStorage.getItem(text))
        arr.pop()
        localStorage.setItem(text, JSON.stringify(arr))
      }
      localStorage.setItem(text, JSON.stringify(noArr.concat(JSON.parse(localStorage.getItem(text)))))
    }else { // 首次创建
      localStorage.setItem(text, JSON.stringify(noArr))
    }
  }
})
